var e = require;
var t = module;
var n = exports;
Object.defineProperty(n, "__esModule", {
    value: !0
});
var o = e("VideoHint"),
    i = cc._decorator,
    a = i.ccclass,
    r = i.property,
    s = function (e) {
        __extends(t, e);
        function t() {
            var t = null !== e && e.apply(this, arguments) || this;
            t.shareNodes = [];
            t.sharePanelNode = null;
            t.rIndex = 0;
            t.isCDTime = !1;
            t.closeBtn = null;
            return t
        }
        n = t;
        t.prototype.onLoad = function () {
            n.Instance = this
        };
        t.prototype.showSharePanel = function () {
            if (SDK.Mgr.Inst.hasAds && !this.isCDTime) {
                this.sharePanelNode.active = !0;
                SDK.Base.Event.emit("PanelOpen");
                this.rIndex = Math.floor(Math.random() * this.shareNodes.length);
                for (var e = 0; e < this.shareNodes.length; e++) this.shareNodes[e].active = e == this.rIndex
                SDK.Mgr.Inst.showInsert()
            }
        };
        t.prototype.closeSharePanel = function () {
            var e = this;
            this.sharePanelNode.active = !1;
            SDK.Base.Event.emit("PanelClose");
            this.scheduleOnce(function () {
                // SDK.Mgr.Inst.isAdOpen && SDK.Mgr.Inst.curChannel != SDK.Define.Channel.android_oppo && 
                SDK.Mgr.Inst.showInsert()
            },
                1);
            this.isCDTime = !0;
            this.scheduleOnce(function () {
                e.isCDTime = !1
            },
                20);
            SDK.Mgr.Inst.curChannel != SDK.Define.Channel.oppo && SDK.Mgr.Inst.curChannel != SDK.Define.Channel.vivo && SDK.Mgr.Inst.showBanner()
        };
        t.prototype.showVideo = function () {
            var e = this,
                t = "SharePanel_Ad";
            SDK.Mgr.Inst.event(t + "Click");
            var n = function (i) {
                if (i == SDK.Define.AdsCode.finish) {
                    SDK.Mgr.Inst.event(t + "Success");
                    e.sharePanelNode.active = !1;
                    SDK.ToastMgr.Inst.showToast("解锁成功，敬请期待！")
                } else if (i == SDK.Define.AdsCode.cancel) {
                    SDK.Mgr.Inst.event(t + "Cancel");
                    o.default.Instance.openPanel(n)
                } else {
                    SDK.ToastMgr.Inst.showToast("暂无广告，请稍后再试");
                    SDK.Mgr.Inst.event(t + "NoAd")
                }
            };
            SDK.Mgr.Inst.showVideo(n)
        };
        t.prototype.adBtnClick = function () {
            this.showVideo()
        };
        var n;
        t.Instance = null;
        __decorate([r([cc.Node])], t.prototype, "shareNodes", void 0);
        __decorate([r(cc.Node)], t.prototype, "sharePanelNode", void 0);
        __decorate([r(cc.Node)], t.prototype, "closeBtn", void 0);
        return n = __decorate([a], t)
    }(cc.Component);
n.default = s